<!DOCTYPE html><html lang="zh-CN"><head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>fquarter | Moment.js &#x6587;&#x6863;</title>
  <link rel="stylesheet" href="static/css/style.css">
  <link rel="shortcut icon" href="http://momentjs.cn/static/img/moment-favicon.png">
  <link rel="stylesheet" href="static/css/atom-one-light.min.css">
</head>
<body class="is-moment">
  <div class="hero hero-oneline">
    <div class="hero-centered">
      <h1>fquarter</h1>
    </div>
  </div>
  <div id="api-section-__FILENAME__">
    <div id="content" class="clearfix">
  
      <div id="column1" data-id="__ID__" class="interior">
        <header>
          <!-- <h1>fquarter</h1> -->
          <div id="gtoc">
            <ul>
              <!-- <li>v</li> -->
              <li>
                <a href="index.html#/plugins/fquarter/" name="toc">&#x8FD4;&#x56DE;&#x4E0A;&#x5C42;&#x6587;&#x6863;</a>
              </li>
              <li style="border: none;">
                <a href="javascript:window.open('https://github.com/momentjscn/moment-docs-cn/edit/master/moment/10-plugins/13-fquarter.md');" rel="nofollow" target="_blank">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a>
              </li>
              <!-- <li>
                <a href="/search__SEARCH_PARAM__" name="toc">搜索</a>
              </li> -->
            </ul>
          </div>
          <hr>
        </header>

        <div id="biz_item"></div>
  
        <div id="apicontent">
          <div id="content_left">
<p>&#x5982;&#x679C;&#x9700;&#x8981;<a href="javascript:window.open('http://nodejs.cn/s/4UWmnJ');" target="_blank" rel="nofollow">&#x8D22;&#x653F;</a>&#x3001;&#x65E5;&#x5386;&#x6216;&#x5B66;&#x672F;&#x5B63;&#x5EA6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <a href="javascript:window.open('http://nodejs.cn/s/QBhRk7');" target="_blank" rel="nofollow">@robgallen</a> &#x7684; <a href="javascript:window.open('http://nodejs.cn/s/Pv7gwe');" target="_blank" rel="nofollow">moment-fquarter</a> &#x63D2;&#x4EF6;&#x3002;</p>
<p>&#x6700;&#x7B80;&#x5355;&#x7684;&#x662F;&#xFF0C;&#x53EA;&#x9700;&#x5728;&#x4EFB;&#x4F55; moment &#x5BF9;&#x8C61;&#x4E0A;&#x8C03;&#x7528; fquarter &#x65B9;&#x6CD5;&#x3002;
&#x5B83;&#x8FD4;&#x56DE;&#x683C;&#x5F0F;&#x5316;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5176;&#x4E2D;&#x56DB;&#x6708;&#x662F;&#x7B2C;&#x4E00;&#x5B63;&#x5EA6;&#x3002;</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter();
// Q4 2012/13
</code></pre>
<p>&#x53EF;&#x4EE5;&#x5C06;&#x4EFB;&#x4F55;&#x6708;&#x4EFD;&#x4F5C;&#x4E3A;&#x8D77;&#x59CB;&#x5B63;&#x5EA6;&#xFF0C;&#x4F8B;&#x5982;&#x4E03;&#x6708;&#xFF1A;</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter(7);
// Q3 2012/13
</code></pre>
<p>&#x5982;&#x679C;&#x9700;&#x8981;&#x65E5;&#x5386;&#x5B63;&#x5EA6;&#xFF0C;&#x5219;&#x4ECE;&#x4E00;&#x6708;&#x5F00;&#x59CB;&#xFF1A;</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter(1);
// Q1 2013
</code></pre>
					</div>
          <div id="content_right">
<p>If you ever have need for <a href="javascript:window.open('https://en.wikipedia.org/wiki/Fiscal_year');" target="_blank" rel="nofollow">Fiscal</a>, Calendar or Academic quarters, you can use the <a href="javascript:window.open('https://github.com/robgallen/moment-fquarter');" target="_blank" rel="nofollow">moment-fquarter</a> plugin by <a href="javascript:window.open('https://github.com/robgallen');" target="_blank" rel="nofollow">@robgallen</a>.</p>
<p>At its simplest, just call the fquarter method on any moment object. It returns a formatted string with April being the first quarter.</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter();
// Q4 2012/13
</code></pre>
<p>You can pass in any month as the starting quarter, e.g. July</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter(7);
// Q3 2012/13
</code></pre>
<p>If you want calendar quarters, start in January</p>
<pre><code class="language-javascript">moment(&quot;2013-01-01&quot;).fquarter(1);
// Q1 2013
</code></pre>
					</div>
          <div></div>
        </div>
      </div>
    </div>
  </div>
  
  <script src="static/js/highlight.min.js"></script>
  <script src="static/js/javascript.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script>var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?7a7f78c805fbacc7e075d34f153031aa"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script>

  <style>
    .hero-centered {
      margin: 0;
          margin-left: 10px;
    }
#gtoc ul {
  list-style: none;
  margin-left: 0;
  line-height: 1.5rem;
  padding: 0;
}
#gtoc>ul>li {
  display: inline;
  border-right: 1px solid #000;
  margin-right: .4rem;
  padding-right: .4rem;
}
#gtoc>ul>li>a {
  color: #61b2a7;
}
#content_left {
  width: 49%;float: left;border-right: 1px solid #eee;    padding-right: 2%;
}
#content_right {
float: left;width: 48%;margin-left: 3%;
}
#column1 {
  padding: 0 2rem;
}
  </style>


</body></html>